public class Group6 {
	
	public void addComment(String comment) {
    }
	
	public void searchReport(String report) {
    }
	
	public void changeStatus() {
    }
	
	public void rateUser() {
    }
	
	public void rateComment() {
    }
	
	public void rateReport() {
    }
	
	public void register(User user ){
		boolean validUser = validateUser(user);
		if(validUser){
			//save user to database
		}
		else{
			//show error messages on gui
		}
		
	}
	
	private boolean validateUser(User user){
		if(!checkTelephone(user.getTelephone()))
			return false;
		if(!checkEmail(user.getEmail()))
			return false;
		if(!validPass(user.getPassword()))
			return false;
		return true;
	}
	
	
	public static boolean checkTelephone(String _telephone){
		if(_telephone.length()!=10)
		return false;

		for(int i=0;i<10;i++){

		if(!(_telephone.charAt(i)<=57 && _telephone.charAt(i)>=48))
		return false;
		}
		return true;	
		}
      
	//checking valid password. password should longer than 6 char
	public static boolean validPass(String _password){
			if(_password.length()<7)
				return false;				
			return true;		
	}
	
	public static boolean checkEmail(String _email){
		int atPosition;
		atPosition=_email.indexOf('@');

		if(atPosition==-1)
      return false;

		int nt;
		nt=_email.lastIndexOf('.');

		if(nt<atPosition)
			return false;

		if(nt==_email.length()-1)
			return false;
    if(nt==atPosition+1)
      return false;

		return true;

	}
	public static void main(String argv[]){	
	}
}




class User{
	
	
	private int userId;
	public String username;
	private String name;
	private String password;
	private String address;
	private String telephone;
	private String email;
	private String location;
	private int rank;
	public int getUserId() {
		return userId;
	}
	public void setUserId(int userId) {
		this.userId = userId;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getTelephone() {
		return telephone;
	}
	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getLocation() {
		return location;
	}
	public void setLocation(String location) {
		this.location = location;
	}
	public int getRank() {
		return rank;
	}
	public void setRank(int rank) {
		this.rank = rank;
	}
	
}

